package com.simga.library.http;

public class Response<T> {

    private int code = -10086;
    private String message;
    private T data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    /**
     * 是否请求失败
     *
     * @return 成功返回true, 失败返回false
     */
    public boolean isCodeInvalid() {
        return code == 2000000;
    }

    @Override
    public String toString() {
        return "Response{" +
                "status=" + code +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }

}
